package com.yutianran.springBoot.spider;

import io.reactivex.functions.Function;
import okhttp3.Headers;

import java.util.Map;

class MapHeadersFunction implements Function<Map<String, String>, Headers> {
    @Override
    public Headers apply(Map<String, String> map) throws Exception {
        Headers.Builder builder = new Headers.Builder();
        for (Map.Entry<String, String> entry : map.entrySet()) {
            builder.add(entry.getKey(), entry.getValue());
        }
        return builder.build();
    }
}
